#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <assert.h>

char* my_strncpy(char* dest, const char* src, size_t num)
{
	assert(dest && src);
	char* ret = dest;
	while ((*src != '\0') && (num != 0))
	{
		*(dest++) = *(src++);
		num--;
	}
	while (num != 0)
	{
		*dest++ = '\0';
		num--;
	}
	return ret;
}

int main()
{
	char arr1[] = "hello";
	char arr2[256] = "xxxxxxxxxxxxx";
	my_strncpy(arr2, arr1, 3);
	printf("%s", arr2);
	return 0;
}